#include <iostream> 
using namespace std;
int main()
{
	int year;
	int x;
	cin>>year;
	if (year>1582)
	{
		if (year%4==0 && year%100!=0) x=1;
		else if (year%100==0 && year%400==0) x=1;
		else x=0;
		cout<<x<<endl;
	}
	else cout<<"Error!"<<endl;
	return 0;
}
